#
# @lc app=leetcode.cn id=20 lang=python3
#
# [20] 有效的括号
#

# @lc code=start
class Solution:
    def isValid(self, s: str) -> bool:
        if len(s) % 2 != 0:
            return False
        for i in range(len(s)//2):
            s = s.replace('()', '').replace('[]', '').replace('{}', '')
        return s == ''
# @lc code=end

